package com.example.business;

import com.example.client.NetworkChannel;

public class ReceiveFileBusiness implements BusinessStrategy {
    private NetworkChannel networkChannel;

    // 构造方法，注入网络通道
    public ReceiveFileBusiness(NetworkChannel networkChannel) {
        this.networkChannel = networkChannel;
    }

    @Override
    public void execute() {
        // 接收文件的业务逻辑实现
        String receivedData = networkChannel.receiveData(); // 接收文件内容
        if (receivedData != null) {
            System.out.println("文件接收成功: " + receivedData);
            // 此处可以将接收到的文件内容保存到本地文件系统
        }
    }
}
